<?php

namespace app\api\controller;

use app\common\controller\Api;
use app\common\model\Category;
use app\common\model\User;

/**
 * 业务员接口
 */
class Salesman extends Api
{
    protected $noNeedLogin = [''];
    protected $noNeedRight = ['*'];
    /**
     * @Author LK
     * @ApiTitle (我的团队)
     * @ApiMethod (GET)
     * @ApiParams (name="type", type="integer", required=true, sample="", description="1=一级粉丝；2=合作商粉丝")
     * @ApiReturnParams (name="code", type="integer", required=true, description="")
     * @ApiReturn ({'code':1,'msg':'返回成功'})
     */
    public function team()
    {
        $get = request()->get();
        extract($get);
        $user = new User();
        $user->where('pid', $this->auth->id);
        switch ($type) {
            case 1:
                $user->where('partner', 0);
                break;
            case 2:
                $user->where('partner', 3);
                break;
        }
        $list = $user->order('id desc')->paginate();
        $this->success('请求成功', $list);
    }
}
